package fr.pud.client.view;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JPanel;

/**
 * Apr 8, 2012 - Projet_Ose.
 * @author Simon Devineau, Adrien Hierry, Leopold Houdin, Pierre Reliquet
 *         Ecole des Mines de Nantes
 *         MainPanel.java
 *         This class create the main panel of the frame where the map is print.
 */
public class MainPanel extends JPanel {
    public final static double DEFAULT_LATITUDE  = 47.21806;
    public final static double DEFAULT_LONGITUDE = -1.55278;
    public final static int    DEFAULT_ZOOM      = 12;
    /**
     * The serial version UID.
     */
    private static final long  serialVersionUID  = -9185848921871589568L;

    /**
     * Default constructor which set up the GUI
     */
    public MainPanel() {
        super();
        this.prepareLayout();
        this.prepareMapViewer();
        this.setVisible(true);
    }

    /**
     * Configure the GUI with a grid layout and GUI_NUMBER_PARTS rows and one
     * column
     */
    private void prepareLayout() {
        this.setLayout(new BorderLayout());
        this.setBackground(Color.LIGHT_GRAY);
    }

    /**
     * Configure the map created by JMpaViewer
     */
    private void prepareMapViewer() {
        JMapViewerExtended.getJMapViewer().setDisplayPositionByLatLon(
                DEFAULT_LATITUDE, DEFAULT_LONGITUDE, DEFAULT_ZOOM);
        this.add(JMapViewerExtended.getJMapViewer(), BorderLayout.CENTER);
    }
}
